//
//  SettingViewController.m
//  Project_A
//
//  Created by 房磊 on 15/1/15.
//  Copyright (c) 2015年 Flowers. All rights reserved.
//

#import "SettingViewController.h"

@interface SettingViewController ()

@end

@implementation SettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor orangeColor];
    self.navigationItem.title = @"设置";
    
    
    self.myTableView = [[UITableView alloc]initWithFrame:[[UIScreen mainScreen]bounds] style:UITableViewStylePlain];
    _myTableView.dataSource = self;
    _myTableView.delegate = self;
    [self.view addSubview:_myTableView];
    [_myTableView release];
    
    
    
    
    
    
    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIndentifier = @"reuse";
    if (indexPath.section == 0) {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIndentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentifier] autorelease];
        }
        NSArray *array = [NSArray arrayWithObjects:@"下载管理",@"关于软件",@"清除缓存", nil];
        cell.textLabel.text = [array objectAtIndex:indexPath.row];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        return cell;
    }else
    {
        SettingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIndentifier];
        if (cell == nil) {
            cell = [[[SettingTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentifier] autorelease];
        }
        NSArray *array = [NSArray arrayWithObjects:@"仅WIFI下载",@"自动下载",@"开启下载提示", nil];
        cell.textLabel.text = [array objectAtIndex:indexPath.row];
        return cell;
    }
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0 && indexPath.row == 0) {
        DownloadViewController *DVC = [[DownloadViewController alloc]init];
        [self.navigationController pushViewController:DVC animated:YES];
    }
    if (indexPath.section == 0 && indexPath.row == 1) {
        // 模态出一张图片来 做关于软件的 封面
        NSLog(@"模态出一张图片来 做关于软件的 封面");
    }
    if (indexPath.section == 0 && indexPath.row == 2){
       // 清除缓存, 数据处理
        NSLog(@"清除缓存, 数据处理");
    }
    if (indexPath.section == 1 && indexPath.row == 1) {
                
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
